var a = getApp();

Page({
    data: {
        page: 1
    },
    onLoad: function(a) {
        this.getData();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        if (!(this.data.current_page >= this.data.last_page)) {
            var a = this.data.page + 1;
            this.setData({
                page: a
            }), this.getMoreData();
        }
    },
    onShareAppMessage: function() {},
    getData: function() {
        wx.showLoading({
            title: "加载中"
        });
        var t = this, e = a.getNetAddresss("plugin.store-card.Frontend.Modules.Income.Controllers.records.index");
        a._postNetWork({
            url: e,
            data: {
                page: t.data.page
            },
            success: function(a) {
                var e = a.data;
                wx.hideLoading({
                    success: function(a) {}
                }), 1 == e.result ? (console.log(e), t.setData({
                    base_data: e.data.base_data,
                    page_list: e.data.page_list.data,
                    current_page: e.data.page_list.current_page,
                    last_page: e.data.page_list.last_page
                })) : wx.showToast({
                    title: e.msg,
                    duration: 1e3,
                    icon: "none"
                });
            },
            fail: function(a) {
                console.log(a.msg);
            }
        });
    },
    getMoreData: function() {
        wx.showLoading({
            title: "加载中"
        });
        var t = this, e = a.getNetAddresss("plugin.store-card.Frontend.Modules.Income.Controllers.records.index");
        a._postNetWork({
            url: e,
            data: {
                page: t.data.page
            },
            success: function(a) {
                var e = a.data;
                if (wx.hideLoading({
                    success: function(a) {}
                }), 1 == e.result) {
                    console.log(e);
                    var o = e.data.page_list.data;
                    t.setData({
                        page_list: t.data.page_list.concat(o),
                        current_page: e.data.page_list.current_page,
                        last_page: e.data.page_list.last_page
                    });
                } else wx.showToast({
                    title: e.msg,
                    duration: 1e3,
                    icon: "none"
                });
            },
            fail: function(a) {
                console.log(a.msg);
            }
        });
    }
});